<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>b5laravelcmf</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="csrf-token" content="HqUkAyvAJtGfU7LglOyhHFnkT7slOCHcDouCDxXY">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link href="/static/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="/static/plugins/fontawesome/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/static/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="/static/plugins/layui/css/layui.css" rel="stylesheet">
    <link href="/static/plugins/animate/animate.css" rel="stylesheet"/>
    <link href="/static/admin/css/style.css" rel="stylesheet"/>
    <link href="/static/admin/css/iframe-ui.css" rel="stylesheet"/>
    <script>
        var bootUrl = {
            url: '/admin/role/index',
            createUrl: '/admin/role/create',
            updateUrl: '/admin/role/update',
            removeUrl: '/admin/role/remove',
            removeAllUrl: '/admin/role/removeAll',
            clearCacheUrl: '/admin/role/clearCache',
        }
    </script>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="role-form">
                <div class="select-list">
                    <ul>
                        <li>角色名称：
                            <input
                                    type=" text "
                                    name="like[name]"
                                    value=""
                                    autocomplete="off"
                            />


                        </li>
                        <li>权限字符：
                            <input
                                    type=" text "
                                    name="where[rolekey]"
                                    value=""
                                    autocomplete="off"
                            />


                        </li>
                        <li>角色状态：
                            <select
                                    name="where[status]"
                            >
                                <option value="">所有</option>
                                <option value="1"

                                >正常</option>
                                <option value="0"

                                >停用</option>
                            </select>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success "
               onclick="$.operate.add('',this)"
               data-width=""
               data-height=""
            >
                <i class="fa fa-plus"></i> 新增
            </a>

            <a
                    class="btn btn-primary single "
                    onclick="$.operate.edit('',this)"
            >
                <i class="fa fa-edit"></i> 修改
            </a>

            <a class="btn btn-danger multiple " onclick="$.operate.removeAll(this)" data-column="">
                <i class="fa fa-remove"></i> 删除
            </a>

        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<script src="/static/plugins/jquery/jquery-1.12.4.min.js"></script>
<script src="/static/plugins/bootstrap/js/bootstrap.min.js?v=asdasd"></script>
<!-- bootstrap-table 表格插件 -->
<script src="/static/plugins/bootstrap-table/bootstrap-table.min.js"></script>
<script src="/static/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>
<script src="/static/plugins/bootstrap-table/extensions/mobile/bootstrap-table-mobile.min.js"></script>
<!-- jquery-validate 表单验证插件 -->
<script src="/static/plugins/validate/jquery.validate.min.js"></script>
<script src="/static/plugins/validate/messages_zh.min.js"></script>
<script src="/static/plugins/validate/jquery.validate.extend.js"></script>
<script src="/static/plugins/blockUI/jquery.blockUI.js"></script>
<script src="/static/plugins/iCheck/icheck.min.js"></script>
<script src="/static/plugins/layui/layui.js"></script>
<script src="/static/admin/js/iframe-ui.js"></script>
<script src="/static/admin/js/common.js"></script>
<script>
    $(function () {
        var options = {
            modalName: "角色",
            sortName:'listsort',
            columns: [
                {checkbox: true},
                {field: 'id', title: '角色ID', align: 'center', sortable: true},
                {field: 'name', title: '角色名称'},
                {field: 'rolekey', title: '权限字符'},
                {field: 'listsort', title: '显示顺序',align: 'center', sortable: true},
                {
                    title: '状态',
                    field: 'status',
                    align: 'center',
                    sortable: true,
                    formatter: function (value, row, index) {
                        return $.view.statusTools(row,true);
                    }
                },
                {field: 'create_time', title: '创建时间', align: 'center', sortable: true},
                {field: 'update_time', title: '更新时间', align: 'center', sortable: true,visible: false},
                {field: 'note', title: '备注',visible: false},
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs" href="javascript:;" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs" href="javascript:;" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
                        var more = [];

                        more.push("<a class='btn btn-default btn-xs' href='javascript:;' onclick='authMenu(" + row.id + ")'><i class='fa fa-check-square-o'></i>菜单权限</a> ");
                        more.push("<a class='btn btn-default btn-xs' href='javascript:;' onclick='authUser(" + row.id + ")'><i class='fa fa-user'></i>分配用户</a>");
                        actions.push('<a tabindex="0" class="btn btn-info btn-xs" data-placement="left" data-toggle="popover" data-html="true" data-trigger="focus" data-container="body" data-content="' + more.join('') + '"><i class="fa fa-chevron-circle-right"></i>更多操作</a>');

                        return actions.join('');
                    }
                }
            ]
        };
        $.table.init(options);
    });
    /* 角色管理-分配用户 */
    function authUser(roleId) {
        var url = mUrl + '/adminrole/index?role_id=' + roleId;
        $.modal.openTab("分配用户", url);
    }
    /* 角色管理-菜单授权 */
    function authMenu(roleId) {
        var url = cUrl + '/auth?role_id=' + roleId;
        $.modal.open("菜单授权", url);
    }
</script>
</body>
</html>
